From a1c8afa36ae4aa9280362a626bec20504ca92bad Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Aug 2008 09:29:28 +0000 Subject: [PATCH] (Fexpand_file_name): Convert the value of $HOME to a multibyte string. --- src/fileio.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/fileio.c b/src/fileio.c index cc6c7c2d3a7..4f703a8a743 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1066,6 +1066,7 @@ See also the function `substitute-in-file-name'. */) int length; Lisp_Object handler, result; int multibyte; + Lisp_Object hdir; CHECK_STRING (name); @@ -1369,9 +1370,19 @@ See also the function `substitute-in-file-name'. */) #endif /* VMS */ || nm[1] == 0) /* ~ by itself */ { + Lisp_Object tem; + if (!(newdir = (unsigned char *) egetenv ("HOME"))) newdir = (unsigned char *) ""; nm++; + /* egetenv may return a unibyte string, which will bite us since + we expect the directory to be multibyte. */ + tem = build_string (newdir); + if (!STRING_MULTIBYTE (tem)) + { + hdir = DECODE_FILE (tem); + newdir = SDATA (hdir); + } #ifdef DOS_NT collapse_newdir = 0; #endif -- 2.30.2